/**
 * 
 */
package org.vsg.common.biz.uid;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * @author Bill vison
 *
 */
public class UIDHelper {
	
	
	
	public static String degistUUID(String uid , String algorithm) {
		MessageDigest md = null;
        try {
            md = MessageDigest.getInstance(algorithm);
        } catch (NoSuchAlgorithmException e) {
            //todo have to be properly handled
        }
        
        md.update(uid.getBytes());
        byte[] array = md.digest();
        
        StringBuffer sb2 = new StringBuffer();
        for (int j = 0; j < array.length; ++j) {
            int b = array[j] & 0xFF;
            sb2.append(Integer.toHexString(b));
        }        
        
        return sb2.toString().toUpperCase();
	}

}
